<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  
  <title>花椒茴香的博客</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta property="og:type" content="website">
<meta property="og:title" content="花椒茴香的博客">
<meta property="og:url" content="http://huajiaohuixiang.gitee.io/page/2/index.html">
<meta property="og:site_name" content="花椒茴香的博客">
<meta property="og:locale" content="en_US">
<meta property="article:author" content="John Doe">
<meta name="twitter:card" content="summary">
  
    <link rel="alternate" href="/atom.xml" title="花椒茴香的博客" type="application/atom+xml">
  
  
    <link rel="shortcut icon" href="/favicon.png">
  
  
    
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/typeface-source-code-pro@0.0.71/index.min.css">

  
  
<link rel="stylesheet" href="/css/style.css">

  
    
<link rel="stylesheet" href="/fancybox/jquery.fancybox.min.css">

  
<meta name="generator" content="Hexo 5.4.0"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">花椒茴香的博客</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://huajiaohuixiang.gitee.io"></form>
      </div>
    </div>
  </div>
</header>

      <div class="outer">
        <section id="main">
  
    <article id="post-安装mysql、redus" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2021/10/25/%E5%AE%89%E8%A3%85mysql%E3%80%81redus/" class="article-date">
  <time class="dt-published" datetime="2021-10-25T07:15:03.000Z" itemprop="datePublished">2021-10-25</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="p-name article-title" href="/2021/10/25/%E5%AE%89%E8%A3%85mysql%E3%80%81redus/">安装mysql、redus</a>
    </h1>
  

      </header>
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h3 id="Linux-Ubuntu18-01安装redis和Mysql"><a href="#Linux-Ubuntu18-01安装redis和Mysql" class="headerlink" title="Linux Ubuntu18.01安装redis和Mysql"></a>Linux Ubuntu18.01安装redis和Mysql</h3><h4 id="1-安装redis"><a href="#1-安装redis" class="headerlink" title="1.安装redis"></a>1.安装redis</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get update</span><br><span class="line">sudo apt-get install redis-server</span><br></pre></td></tr></table></figure>

<h4 id="2-启动redis"><a href="#2-启动redis" class="headerlink" title="2.启动redis"></a>2.启动redis</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">redis-server</span><br></pre></td></tr></table></figure>

<h4 id="3-让其他电脑可以访问"><a href="#3-让其他电脑可以访问" class="headerlink" title="3.让其他电脑可以访问"></a>3.让其他电脑可以访问</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">dpkg -S redis_server 显示包含此软件包的所有位置，</span><br></pre></td></tr></table></figure>

<p>有一个/etc/redis/redis.conf 文件</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/redis/redis.conf  //打开</span><br></pre></td></tr></table></figure>

<p>关闭保护模式并将127.0.0.1换成0.0.0.0</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">bind 127.0.0.1 ::1     换成 bind 0.0.0.0 ::1</span><br><span class="line">protected-mode yes     换成 protected-mode no</span><br></pre></td></tr></table></figure>

<p>保存退出重启</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo systemctl restart redis-server</span><br></pre></td></tr></table></figure>

<p>配置密码 在vim 中输入</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">: /requirepass</span><br></pre></td></tr></table></figure>

<p>找到之后取消注释，然后将后面的密码换成自己的。 然后再重启一下</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo systemctl restart redis-server</span><br></pre></td></tr></table></figure>

<h4 id="1-安装Mysql"><a href="#1-安装Mysql" class="headerlink" title="1.安装Mysql"></a>1.安装Mysql</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo apt install mysql-server</span><br><span class="line">sudo systemctl status mysql  //安装完成后输入这个看看状态</span><br></pre></td></tr></table></figure>

<h4 id="2-然后可以根据阿里云的这个增加一下数据库安全"><a href="#2-然后可以根据阿里云的这个增加一下数据库安全" class="headerlink" title="2.然后可以根据阿里云的这个增加一下数据库安全"></a>2.然后可以根据阿里云的这个增加一下数据库安全</h4><p><a target="_blank" rel="noopener" href="https://yq.aliyun.com/articles/758177">https://yq.aliyun.com/articles/758177</a></p>
<h4 id="3-配置外网访问"><a href="#3-配置外网访问" class="headerlink" title="3.配置外网访问"></a>3.配置外网访问</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">cd /etc/mysql</span><br><span class="line"></span><br><span class="line">//然后ls一下 我的有下面这些东西，配置文件在mysql.conf.d中</span><br><span class="line">//conf.d      debian-start  my.cnf.fallback  mysql.conf.d</span><br><span class="line">//debian.cnf  my.cnf        mysql.cnf</span><br><span class="line"></span><br><span class="line">cd mysql.conf.d</span><br><span class="line">vim mysqld.cnf</span><br><span class="line">     //将地址127.0.0.1 改成0.0.0.0</span><br><span class="line">service mysql restart</span><br></pre></td></tr></table></figure>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://huajiaohuixiang.gitee.io/2021/10/25/%E5%AE%89%E8%A3%85mysql%E3%80%81redus/" data-id="ckvf4x3n4000aokv1b6t5e9z6" data-title="安装mysql、redus" class="article-share-link">Share</a>
      
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/mysql/" rel="tag">mysql</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/redis/" rel="tag">redis</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E6%9C%8D%E5%8A%A1%E5%99%A8/" rel="tag">服务器</a></li></ul>

    </footer>
  </div>
  
</article>



  
    <article id="post-散落的记录" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2021/10/25/%E6%95%A3%E8%90%BD%E7%9A%84%E8%AE%B0%E5%BD%95/" class="article-date">
  <time class="dt-published" datetime="2021-10-25T07:12:58.000Z" itemprop="datePublished">2021-10-25</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="p-name article-title" href="/2021/10/25/%E6%95%A3%E8%90%BD%E7%9A%84%E8%AE%B0%E5%BD%95/">散落的记录</a>
    </h1>
  

      </header>
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <p>那些80年代的红砖还能叫红色吗，大概只能算是煤球渣子的近亲。正如唱歌的最终会沉默，昨日奔跑着的青年和鸵鸟，一转眼就是今天的腐肉、秃鹫。</p>
<p>天下为私</p>
<p>大道之行也，天下为公；</p>
<p>今大道既隐，天下为家；</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://huajiaohuixiang.gitee.io/2021/10/25/%E6%95%A3%E8%90%BD%E7%9A%84%E8%AE%B0%E5%BD%95/" data-id="ckvf4x3n7000fokv1a4jabgf1" data-title="散落的记录" class="article-share-link">Share</a>
      
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" rel="tag">读书笔记</a></li></ul>

    </footer>
  </div>
  
</article>



  
    <article id="post-Jetson安装Mysql" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2021/10/25/Jetson%E5%AE%89%E8%A3%85Mysql/" class="article-date">
  <time class="dt-published" datetime="2021-10-25T07:11:31.000Z" itemprop="datePublished">2021-10-25</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="p-name article-title" href="/2021/10/25/Jetson%E5%AE%89%E8%A3%85Mysql/">Jetson安装Mysql</a>
    </h1>
  

      </header>
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h1 id="如何使用JetsonNano或者树莓派搭建自己的服务器？"><a href="#如何使用JetsonNano或者树莓派搭建自己的服务器？" class="headerlink" title="如何使用JetsonNano或者树莓派搭建自己的服务器？"></a>如何使用JetsonNano或者树莓派搭建自己的服务器？</h1><h3 id="nano介绍"><a href="#nano介绍" class="headerlink" title="nano介绍"></a>nano介绍</h3><h4 id="Jetson-Nano和树莓派的区别"><a href="#Jetson-Nano和树莓派的区别" class="headerlink" title="Jetson Nano和树莓派的区别"></a>Jetson Nano和树莓派的区别</h4><p>Jetson Nano 是一款功能强大的小型计算机，专为支持入门级边缘 AI 应用程序和设备而设计，拥有完善的 NVIDIA JetPack™ SDK 包含用于深度学习、计算机视觉、图形、多媒体等方面的加速库。 相比于树莓派多了显卡，也就是你可以通过图形化界面去操作，不只是命令行，在图像处理方面很强。</p>
<h4 id="系统"><a href="#系统" class="headerlink" title="系统"></a>系统</h4><p>Jetson nano 官方系统是ubuntu，是在ubuntu上修改的NVIDIA系统 ubuntu18.04 LTS，好像是是aarch架构，系统界面如下</p>
<h3 id="安装配置mysql"><a href="#安装配置mysql" class="headerlink" title="安装配置mysql"></a>安装配置mysql</h3><h4 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h4><p>和直接在ubuntu上安装没有什么区别，直接使用apt-get install mysql-server 得到的是5.x版本，不是最新的8.x版本 使用 apt-get 安装完后 会生成一些默认的账户在 /etc/mysql/debian.cnf中 可以通过sudo cat /etc/mysql/debian.cnf查看</p>
<h4 id="配置用户"><a href="#配置用户" class="headerlink" title="配置用户"></a>配置用户</h4><p>登录应该是需要安装mysqsl-client,也是使用apt-get install mysql-client安装</p>
<p>然后登录</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mysql -u username -p </span><br></pre></td></tr></table></figure>

<p>然后输入密码</p>
<p>新建用户，赋予权限</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">create user &#x27;username&#x27;@&#x27;localhost&#x27; identified by &#x27;password&#x27;;</span><br><span class="line">#username是你想创建的用户名</span><br><span class="line">#localhost是表示它可以通过那个ip来访问，localhost表示本地 其余ip表示其他地址 %表示所有</span><br><span class="line">#password是密码</span><br><span class="line">grant all privileges on 数据库.* to username@ip地址 ;</span><br><span class="line">#好像mysql的用户是通过 username+ip来区别，可以有连个username相同的用户，只要ip不一样。</span><br></pre></td></tr></table></figure>

<h4 id="修改配置文件，实现远程访问"><a href="#修改配置文件，实现远程访问" class="headerlink" title="修改配置文件，实现远程访问"></a>修改配置文件，实现远程访问</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">cd /etc/mysql</span><br><span class="line"></span><br><span class="line">//然后ls一下 我的有下面这些东西，配置文件在mysql.conf.d中</span><br><span class="line">//conf.d      debian-start  my.cnf.fallback  mysql.conf.d</span><br><span class="line">//debian.cnf  my.cnf        mysql.cnf</span><br><span class="line"></span><br><span class="line">cd mysql.conf.d</span><br><span class="line">vim mysqld.cnf</span><br><span class="line">     //将地址127.0.0.1 改成0.0.0.0</span><br><span class="line">service mysql restart</span><br></pre></td></tr></table></figure>

<h4 id="mysql其他常用命令："><a href="#mysql其他常用命令：" class="headerlink" title="mysql其他常用命令："></a>mysql其他常用命令：</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo service mysql restart</span><br><span class="line">sudo netstat -tap | grep mysql        #查看是否允许</span><br></pre></td></tr></table></figure>

<h3 id="配置内网穿透"><a href="#配置内网穿透" class="headerlink" title="配置内网穿透"></a>配置内网穿透</h3><p>我选择使用花生壳进行内网穿透，花生壳还是比较方便的。</p>
<p>应该是可以直接参考树莓派的官方教程<a target="_blank" rel="noopener" href="https://service.oray.com/question/11639.html">https://service.oray.com/question/11639.html</a></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">dpkg -i phtunnel_5_0_rapi_aarch64.deb      #安装</span><br></pre></td></tr></table></figure>

<p>可以通过以下命令来操作：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">phddns           	#查看命令</span><br><span class="line">phddns 	start		#打开</span><br><span class="line">phddns status		#可以查看SN码</span><br></pre></td></tr></table></figure>

<p>打开<a target="_blank" rel="noopener" href="http://b.oray.com/">http://b.oray.com</a> ，在登录页面中输入SN码与默认密码（admin）登录。</p>
<p>剩下的就看官方教程就好了<a target="_blank" rel="noopener" href="https://service.oray.com/question/11639.html">https://service.oray.com/question/11639.html</a></p>
<p>建立的映射应该是tcp类型，绑定到3306端口</p>
<p><strong>注意，需要先给你的Nano 配置IP与MAC绑定，因为你的路由器应该是使用动态分配IP，打开192.168.1.1即可进行绑定，不然每次都要重新 在管理界面绑定一次</strong>。</p>
<h3 id="测试"><a href="#测试" class="headerlink" title="测试"></a>测试</h3><p>可以先在内网测试一下能否脸上nano的mysql，使用ifconfig获得内网地址类似与192.168.1.101，然后在自己电脑上用workbench测试一下。</p>
<p>测试成功后绑定外网然后在外网试一下。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://huajiaohuixiang.gitee.io/2021/10/25/Jetson%E5%AE%89%E8%A3%85Mysql/" data-id="ckvf4x3ms0000okv1h7ji03x8" data-title="Jetson安装Mysql" class="article-share-link">Share</a>
      
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JetsonNano/" rel="tag">JetsonNano</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E6%9C%8D%E5%8A%A1%E5%99%A8/" rel="tag">服务器</a></li></ul>

    </footer>
  </div>
  
</article>



  
    <article id="post-内网穿透" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2021/10/25/%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F/" class="article-date">
  <time class="dt-published" datetime="2021-10-25T07:09:04.000Z" itemprop="datePublished">2021-10-25</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="p-name article-title" href="/2021/10/25/%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F/">内网穿透</a>
    </h1>
  

      </header>
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <p>之前使用花生壳来进行内网穿透，只能穿透一个，相当于没有，然后发现了frp这个神仙项目。</p>
<p>frp可以通过一个有公网IP的服务器来进行转发，服务器启动frps，内网机器启动frps，然后就可以访问内网机器啦。</p>
<h4 id="搭建过程"><a href="#搭建过程" class="headerlink" title="搭建过程"></a>搭建过程</h4><h6 id="硬件条件"><a href="#硬件条件" class="headerlink" title="硬件条件"></a>硬件条件</h6><p>Jetson Nano B01 ，阿里云服务器一台，域名一个。</p>
<h6 id="下载frp"><a href="#下载frp" class="headerlink" title="下载frp"></a>下载frp</h6><p>首先下载frp项目，<a target="_blank" rel="noopener" href="https://github.com/fatedier/frp/releases%EF%BC%8C%E9%98%BF%E9%87%8C%E4%BA%91%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%BA%94%E8%AF%A5%E6%98%AF%E8%A6%81%E4%B8%8B%E8%BD%BDfrp_0.36.2_linux_amd64.tar.gz%EF%BC%8C%E7%84%B6%E5%90%8E%E8%A7%A3%E5%8E%8B%E3%80%82Jetson">https://github.com/fatedier/frp/releases，阿里云服务器应该是要下载frp_0.36.2_linux_amd64.tar.gz，然后解压。Jetson</a> nano需要下载frp_0.36.2_linux_arm.tar.gz，然后解压。</p>
<h6 id="观察frp配置文件"><a href="#观察frp配置文件" class="headerlink" title="观察frp配置文件"></a>观察frp配置文件</h6><p>里面一共有一个systemd文件夹和frpc、frpc.ini、frpc_full.ini、frps、frps.ini、frps_full.ini。systemd先不用管，后面才会用到。</p>
<p>其中frpc和frps是两个启动程序。其余四个ini分别是启动程序的简单配置例子和详细配置例子。</p>
<h6 id="实现ssh"><a href="#实现ssh" class="headerlink" title="实现ssh"></a>实现ssh</h6><p>如果要实现ssh ，服务器和内网机器分别要进行以下配置。</p>
<p>服务器需要配置frps.ini文件，其实不用变哈哈，本来就是这样。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">[common]</span><br><span class="line">bind_port = 7000</span><br></pre></td></tr></table></figure>

<p>然后内网机器需要进行一哈配置frpc.ini</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">[common]</span><br><span class="line">#这个是服务器的公网IP地址</span><br><span class="line">server_addr = 127.0.0.1</span><br><span class="line">#这个是服务器的监听端口，需要和服务器配置文件中的bind_port相同</span><br><span class="line">server_port = 7000</span><br><span class="line"></span><br><span class="line">#下面的ssh配置</span><br><span class="line">[ssh]</span><br><span class="line">#类型是tcp</span><br><span class="line">type = tcp</span><br><span class="line"></span><br><span class="line">#本地ip地址，可以是192.168.1.xxx这种，如果是127.0.0.1就是本机</span><br><span class="line">local_ip = 127.0.0.1、</span><br><span class="line"></span><br><span class="line">#本地端口</span><br><span class="line">local_port = 22</span><br><span class="line"></span><br><span class="line">#服务器端口，我们连接的时候连接服务器的6000端口就好了</span><br><span class="line">remote_port = 6000</span><br></pre></td></tr></table></figure>

<h6 id="实现http"><a href="#实现http" class="headerlink" title="实现http"></a>实现http</h6><p>服务器的frps.ini配置</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">[common]</span><br><span class="line">bind_port = 7000</span><br><span class="line"></span><br><span class="line">#表示用10000来监听http</span><br><span class="line">vhost_http_port = 10000  </span><br></pre></td></tr></table></figure>

<p>本地的frpc.ini配置</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">[common]</span><br><span class="line">server_addr = x.x.x.x  </span><br><span class="line">server_port = 7000</span><br><span class="line"></span><br><span class="line">[web]</span><br><span class="line">type = http</span><br><span class="line">local_port = 10000</span><br><span class="line">custom_domains = 你的域名1或者ip地址</span><br><span class="line"></span><br><span class="line">[web2]</span><br><span class="line">type = http</span><br><span class="line">local_port = 100001</span><br><span class="line">custom_domains = 你的域名2或者ip地址</span><br></pre></td></tr></table></figure>

<p>因为每个web中的custom_domains都必须不同，如果直接写服务器的公网ip的话，只能实现一个http的转发，如果你有域名的话，是可以创建很多子域名，因此可以实现很多http转发。只需要在本地机器的frpc.ini中增加local_port和custon_domains即可。</p>
<h6 id="将其注册成服务"><a href="#将其注册成服务" class="headerlink" title="将其注册成服务"></a>将其注册成服务</h6><p>我是看着这个教程做的<a target="_blank" rel="noopener" href="https://blog.csdn.net/fjh1997/article/details/103672631%EF%BC%8C%E4%BD%86%E6%98%AF%E6%96%87%E4%B8%AD%E5%BA%94%E8%AF%A5%E6%98%AF%E6%9C%89%E4%B8%80%E4%B8%AA%E9%94%99%E8%AF%AF%EF%BC%8C%E2%80%9C%E6%88%91%E4%BB%AC%E6%8A%8A%E4%B8%8B%E8%BD%BD%E5%A5%BD%E7%9A%84%E6%89%80%E6%9C%89*.ini%E6%96%87%E4%BB%B6%E6%94%BE%E5%88%B0/etc/frpc/%E7%9B%AE%E5%BD%95%E4%B8%8B%E2%80%9D%EF%BC%8C%E5%9B%A0%E4%B8%BAfrpc@.service%E4%B8%AD%E7%9A%84%E8%B7%AF%E5%BE%84%E6%98%AF">https://blog.csdn.net/fjh1997/article/details/103672631，但是文中应该是有一个错误，“我们把下载好的所有*.ini文件放到/etc/frpc/目录下”，因为frpc@.service中的路径是</a> /etc/frp 所以应该放在 /etc/frp下。如果放在了frpc下需要改一下service中的路径。</p>
<p>还记得之前的systemd文件夹吗，那个就是注册成服务用的。</p>
<p>cd systemd进入文件夹 ls</p>
<p>一共有四个文件 frpc.service 和 frpc@.service还有frps的，带@和不带@的区别就是带@可以在启动服务的时候指定配置文件，不带@的只能使用文件中固定的配置文件</p>
<p>下面是frpc@.service的内容</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">[Unit]</span><br><span class="line">Description=Frp Client Service</span><br><span class="line">After=network.target</span><br><span class="line"></span><br><span class="line">[Service]</span><br><span class="line">Type=idle</span><br><span class="line">User=nobody</span><br><span class="line">Restart=on-failure</span><br><span class="line">RestartSec=5s</span><br><span class="line">ExecStart=/usr/bin/frpc -c /etc/frp/%i.ini    #重点</span><br><span class="line">ExecReload=/usr/bin/frpc reload -c /etc/frp/%i.ini			#重点</span><br><span class="line"></span><br><span class="line">[Install]</span><br><span class="line">WantedBy=multi-user.target</span><br></pre></td></tr></table></figure>

<p>比较重要的就是这两个</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">ExecStart=/usr/bin/frpc -c /etc/frp/%i.ini   </span><br><span class="line">#这两个分别是frpc的路径和 frpc.ini的路径，其中frpc.ini通过%i实现了实时替换</span><br></pre></td></tr></table></figure>

<p>所以我们重点就是将 frpc 移动到 /usr/bin/下 ， 将 frpc.ini移动带 /etc/frp/下 ， 将frpc@.service移动到/etc/systemd/system/下。</p>
<p>然后通过</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">systemctl enable frpc@frpc  #这步用来注册服务     第一个frpc表示在/etc/systemd/system/下的frpc@.service，第二个frpc表示配置文件的前缀</span><br><span class="line">systemctl start frpc@frpc   #这步用来启动服务 通过x@x来表示 </span><br><span class="line">systemctl restart frpc@test  #如果我想更改配置，那么可以在/etc/frp/下创建test.ini，然后通过这个重新启动。</span><br></pre></td></tr></table></figure>

<p>对于frps也一样哦，移动三个文件，然后注册服务、启动，大功告成啦。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://huajiaohuixiang.gitee.io/2021/10/25/%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F/" data-id="ckvf4x3n20007okv15txqceuy" data-title="内网穿透" class="article-share-link">Share</a>
      
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/frp/" rel="tag">frp</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E7%BD%91%E7%BB%9C/" rel="tag">网络</a></li></ul>

    </footer>
  </div>
  
</article>



  
    <article id="post-罗生门" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2021/10/25/%E7%BD%97%E7%94%9F%E9%97%A8/" class="article-date">
  <time class="dt-published" datetime="2021-10-25T06:50:30.000Z" itemprop="datePublished">2021-10-25</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="p-name article-title" href="/2021/10/25/%E7%BD%97%E7%94%9F%E9%97%A8/">罗生门</a>
    </h1>
  

      </header>
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h4 id="山药粥"><a href="#山药粥" class="headerlink" title="山药粥"></a>山药粥</h4><p>虽然说还是寒冷的冬天，这日天气却很晴朗，和风吹拂，那些清澈的溪水中，河石白得晃眼，干枯的蓬草一动不动。柔滑的阳光洒满了河岸边低垂的杨柳枯枝，鹤鹤鸟栖在枝头毫无动作，影子皆投影在街面上。东山像是被霜打过的天鹅绒，山头圆圆，色泽暗绿，瞧着应该是比睿山吧。阳光照射下，马鞍上的螺钿熠熠闪光，两个人朝着粟田口的方向缓缓前行。</p>
<p>一阵马蹄声在草原上响起来。黄茅草满地都是，一处又一处的水洼映着湛蓝的天空，瞧得人几乎以为这冬天的午后可能会随时被冰冻起来。连绵的群山铺在原野的尽头，大约是背阴的缘故，一层暗淡的紫色抹在山上，原本应该是亮晶晶的残雪连一点光辉都没有。干枯的茅草将肃杀的景色阻隔，两个走路的随从没办法看见前面。</p>
<p>只看见一只狐狸，披着一身暖暖的毛。</p>
<h4 id="烟草与魔鬼"><a href="#烟草与魔鬼" class="headerlink" title="烟草与魔鬼"></a>烟草与魔鬼</h4><p>牛贩子的得救和堕落相附，魔鬼的失败与成功相依。</p>
<h4 id="火男面具"><a href="#火男面具" class="headerlink" title="火男面具"></a>火男面具</h4><p>自桥上向下望，马铁口一样的河水反射着太阳的光线，不时又小汽船驶过来，为河面添上一层闪亮的波纹。热闹的大鼓、笛子和三弦声宛若虱子叮咬了平滑的水面。盛放的樱花自札幌啤酒厂的砖墙尽头，一直绵延到远远的堤岸，粉粉白白，一片朦胧。</p>
<p>在镇上的赏花船上，平吉照例喝上几盅酒，兴头来了便向伴奏的人借来火男面具，跑到船舷上开始跳舞。</p>
<h4 id="六宫小姐"><a href="#六宫小姐" class="headerlink" title="六宫小姐"></a>六宫小姐</h4><p>一心念佛</p>
<h4 id="秋"><a href="#秋" class="headerlink" title="秋"></a>秋</h4><p>这个疑惑会令哭过后的信子心情低落，为了逃开这种情绪，信子便会命令自己在一种愉快的感伤中流连，远眺屋外的风景——松树枝叶上洒着阳光，暮色渐变为淡黄。<br>他停住笔，看着屋外的松林，初冬时节，天空下的松林瞧起来浓郁苍翠，青黛色一眼望不到边。<br>信子心中突然感觉到一种欢喜，而这欢喜残忍且大不应该。<br>她强忍着内心的动荡，一瞬间俊吉便走近了，秋日的阳光洒满全身，在处处皆是水洼的街上走着。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://huajiaohuixiang.gitee.io/2021/10/25/%E7%BD%97%E7%94%9F%E9%97%A8/" data-id="ckvf4x3n5000cokv1333e53hc" data-title="罗生门" class="article-share-link">Share</a>
      
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" rel="tag">读书笔记</a></li></ul>

    </footer>
  </div>
  
</article>



  
    <article id="post-hello-world" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2021/10/25/hello-world/" class="article-date">
  <time class="dt-published" datetime="2021-10-25T06:45:06.485Z" itemprop="datePublished">2021-10-25</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="p-name article-title" href="/2021/10/25/hello-world/">Hello World</a>
    </h1>
  

      </header>
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <p>Welcome to <a target="_blank" rel="noopener" href="https://hexo.io/">Hexo</a>! This is your very first post. Check <a target="_blank" rel="noopener" href="https://hexo.io/docs/">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a target="_blank" rel="noopener" href="https://hexo.io/docs/troubleshooting.html">troubleshooting</a> or you can ask me on <a target="_blank" rel="noopener" href="https://github.com/hexojs/hexo/issues">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">&quot;My New Post&quot;</span></span><br></pre></td></tr></table></figure>

<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/writing.html">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>

<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/server.html">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>

<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/generating.html">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>

<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/one-command-deployment.html">Deployment</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://huajiaohuixiang.gitee.io/2021/10/25/hello-world/" data-id="ckvf4x3mw0001okv1hwoq3gge" data-title="Hello World" class="article-share-link">Share</a>
      
      
      
    </footer>
  </div>
  
</article>



  


  <nav id="page-nav">
    
    <a class="extend prev" rel="prev" href="/">&laquo; Prev</a><a class="page-number" href="/">1</a><span class="page-number current">2</span>
  </nav>

</section>
        
          <aside id="sidebar">
  
    

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/tags/JetsonNano/" rel="tag">JetsonNano</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Kinect/" rel="tag">Kinect</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/frp/" rel="tag">frp</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/" rel="tag">hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/" rel="tag">linux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mysql/" rel="tag">mysql</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/redis/" rel="tag">redis</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/windows/" rel="tag">windows</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/" rel="tag">博客搭建</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%9C%8D%E5%8A%A1%E5%99%A8/" rel="tag">服务器</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%BD%91%E7%BB%9C/" rel="tag">网络</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" rel="tag">读书笔记</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/JetsonNano/" style="font-size: 10px;">JetsonNano</a> <a href="/tags/Kinect/" style="font-size: 10px;">Kinect</a> <a href="/tags/frp/" style="font-size: 10px;">frp</a> <a href="/tags/hexo/" style="font-size: 10px;">hexo</a> <a href="/tags/linux/" style="font-size: 10px;">linux</a> <a href="/tags/mysql/" style="font-size: 10px;">mysql</a> <a href="/tags/redis/" style="font-size: 10px;">redis</a> <a href="/tags/windows/" style="font-size: 10px;">windows</a> <a href="/tags/%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/" style="font-size: 10px;">博客搭建</a> <a href="/tags/%E6%9C%8D%E5%8A%A1%E5%99%A8/" style="font-size: 15px;">服务器</a> <a href="/tags/%E7%BD%91%E7%BB%9C/" style="font-size: 10px;">网络</a> <a href="/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" style="font-size: 20px;">读书笔记</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/12/">December 2021</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/11/">November 2021</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/10/">October 2021</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2021/12/08/%E5%BC%A0%E7%BE%8E%E4%B8%BD/">张美丽</a>
          </li>
        
          <li>
            <a href="/2021/12/08/%E9%9D%92%E9%9D%92/">青青</a>
          </li>
        
          <li>
            <a href="/2021/12/08/%E5%B0%8F%E5%BC%A0%E5%92%8C%E5%B0%8F%E4%B8%BD/">小张和小丽</a>
          </li>
        
          <li>
            <a href="/2021/11/24/%E5%91%90%E5%96%8A/">呐喊</a>
          </li>
        
          <li>
            <a href="/2021/11/24/%E9%87%8E%E8%8D%89/">野草</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      
      &copy; 2021 John Doe<br>
      Powered by <a href="https://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>

    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    


<script src="/js/jquery-3.4.1.min.js"></script>



  
<script src="/fancybox/jquery.fancybox.min.js"></script>




<script src="/js/script.js"></script>





  </div>
</body>
</html>